<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = '7d8a867c870b22bc74c87c348b75528djpeg'
        var a = str.slice(0, 1)
        var b = str.slice(1, 3)
        var c = str.slice(3, str.length)
        var newstr = 'https://cube.elemecdn.com/' + a + '/' + b + '/' + c + '.jpeg'
        console.log(a, b, newstr)

        // var a = str.substr(0, 1)
        // var b = str.substr(1, 2)
        // var c = str.substr(3, str.length - 3)
        // console.log(a, b, str)
        var a = str.substring(0, 3)
        console.log(a, str)
    </script>
</body>
</html>